package com.itmg.analyze.jp.bean;

import com.itmg.analyze.jp.model.YahooAuctionsSearchParamModel;
import com.itmg.util.Constants;
import com.itmg.vo.SearchParameterVO;

/**
 *  获得检索的关键字,排列种类
 * @author Yunhong Chen
 * */

public class YahooAuctionsParaBean {

	public YahooAuctionsParaBean() {
	}
	
	public static YahooAuctionsSearchParamModel getYahooAuctionsSearchParamModel(SearchParameterVO searchParameterVO) throws Exception
	{
		YahooAuctionsSearchParamModel yahooSearchParamModel = new YahooAuctionsSearchParamModel();
		String keyword = searchParameterVO.getKeyword();
		yahooSearchParamModel.setQuery(keyword);
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PRICE_DOWN_TO_UP))
		{
			//yahooSearchParamModel.setSort("%2Bprice");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PV_RANK_DOWN_TO_UP))
		{
			yahooSearchParamModel.setSort("%2sold");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PV_RANK_UP_TO_DOWN))
		{
			yahooSearchParamModel.setSort("-sold");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_AFFLIATE_RATE_DOWN_TO_UP))
		{
			yahooSearchParamModel.setSort("%2affiliate");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_AFFLIATE_RATE_UP_TO_DOWN))
		{
			yahooSearchParamModel.setSort("-affiliate");
		}
		return yahooSearchParamModel;
	}
}
